import axios from 'axios';
axios.defaults.withCredentials = true;

//线下
let address = "/api/"
//线上
// let address = "https://view.dupont-ex.com:8443/KYApi"  

//ld----------------------------------
// 商品列表
export const infosGoodsGetlist = params => { return axios.get(`${address}/infos/goods/getlist`, { params: params }).then(res => res) };
//建仓
export const tradesPositionOpen = params => { return axios.post(`${address}/trades/position/open`, params).then(res => res) };
// 标的列表
export const infosKindsGetlist = params => { return axios.post(`${address}/infos/kinds/getlist`, params).then(res => res) };
//当前持仓列表
export const tradesPositionGetlist = params => { return axios.post(`${address}/trades/position/getlist`, params).then(res => res) };




//hq------------------------------------
export const getvcode = params => { return axios.post(`${address}/customers/regist/getvcode`, params).then(res => res)  }; //验证码
export const registAdd = params => { return axios.post(`${address}/customers/regist/add`, params).then(res => res)  }; //注册
export const loginAdd = params => { return axios.post(`${address}/customers/account/login`, params).then(res => res)  }; //登录
export const passwordAdd = params => { return axios.post(`${address}/customers/password/reset`, params).then(res => res)  }; //重置密码
export const passwordCode = params => { return axios.post(`${address}/customers/password/getvcode`, params).then(res => res)  }; //重置密码验证码
export const binding = params => { return axios.post(`${address}/customers/binding/add`, params).then(res => res)  }; //银行卡绑定
export const bindingCode = params => { return axios.post(`${address}/customers/binding/getvcode`, params).then(res => res)  }; //银行卡绑定验证码
export const accountGet = params => { return axios.post(`${address}/customers/account/get`, params).then(res => res)  }; //账户信息


//tw--------------------------------------


// 公告
export const getlistNotice = params => { return axios.get(`${address}/api/infos/notice/getlist`, { params: params }).then(res => res) };

// 当前委托
export const positionGetlist = params => { return axios.post(`${address}/trades/position/getlist`, params).then(res => res)  }; //当前持仓
export const hisposition = params => { return axios.post(`${address}/trades/hisposition/getlist`, params).then(res => res)  }; //历史委托
export const modifyPosition = params => { return axios.post(`${address}/trades/position/modify`, params).then(res => res)  }; //修改当前持仓
export const closePosition = params => { return axios.post(`${address}/trades/position/close`, params).then(res => res)  }; //平仓

// http://120.24.183.179:1500/api/

































































let base = 'http://103.214.146.209';
let que81 = 'https://quotes.morgan-ex.com/quotations'
let ques81 = 'https://quotes.morgan-ex.com'  //k线图
// axios.interceptors.response.use(function (response) {
//     if (response.data.code == 225) {
//         console.log("请重新登录")
//         // window.top.location.href = "http://www.morgan-ex.com/login"
//     }
//     return response;
// }, function (error) {
//     return Promise.reject(error);
// });

// 获取手机区号
export const getAreaCode = params => { return axios.get(`${base}/user/getAreaCode`, { params: params }).then(res => res) };
// 获取短信/邮箱验证码
export const sendCode = params => { return axios.get(`${base}/user/sendCode`, { params: params }).then(res => res) };
//获取title
//   登录
export const login = params => { return axios.post(`${base}/user/login`, params).then(res => res) };
//   注册
export const registe = params => { return axios.post(`${base}/user/register`, params).then(res => res) };
//忘记登录密码

export const forgetPassword = params => { return axios.post(`${base}/user/forgetPassword`, params).then(res => res) };
//注册
// 获取国家列表
export const Country = params => { return axios.get(`${base}/countryCity/listCountry?page=1&rows=300`, params).then(res => res) };

export const deals = params => { return axios.get(`${que81}/get24hrDataByMotherCoinName`, params).then(res => res) };
// export const addUser = params => { return axios.get(`${base}/user/add`, { params: params }); };
//获取IP
export const ipManage = params => { return axios.get(`${base}/app/loginLog/ipManage`, { params: params }).then(res => res) };
// 实时交易记录
export const getDealRecord = params => { return axios.get(`${que81}/getDealRecord`, { params: params }).then(res => res) };
// 深度图
export const getDepthByTwoCoins = params => { return axios.get(`${que81}/getDepthByTwoCoins`, { params: params }).then(res => res) };

//个人中心基础绑定数据
export const basisInformation = params => { return axios.get(`${base}/user/basisInformation`, { params: params }).then(res => res) };
//  邮箱认证
export const emailAuthentication = params => { return axios.post(`${base}/user/emailAuthentication`, params).then(res => res) };
//绑定手机
export const updatePhoneNo = params => { return axios.post(`${base}/user/updatePhoneNo`, params).then(res => res) };
//修改登录密码
export const updatePassword = params => { return axios.post(`${base}/user/updatePassword`, params).then(res => res) };


//身份认证
export const addNum = params => { return axios.post(`${base}/app/idCard/authentication`, params).then(res => res) };
//获取身份信息
export const lookIdCardInfo = params => { return axios.get(`${base}/app/idCard/lookIdCardInfo`, { params: params }).then(res => res) };
//更换绑定手机

export const updateNewPhone = params => { return axios.post(`${base}/user/updateNewPhone`, params).then(res => res) };
//更换资金密码和重置资金密码
export const setTransactionPassword = params => { return axios.post(`${base}/user/setTransactionPassword`, params).then(res => res) };
//查看母币

export const getMotherCoinName = params => { return axios.get(`${que81}/getMotherCoinName`, params).then(res => res) };


// 资产部分

// 订单部分
//获取子币
export const childCoin = params => { return axios.get(`${base}/virtualWalletPair/childCoin`, { params: params }).then(res => res) };
//获取母币
export const motherCoin = params => { return axios.get(`${base}/virtualWalletPair/motherCoin`, { params: params }).then(res => res) };
//撤单
export const CancelOrder = params => { return axios.post(`${base}/revisedTradePool/update`, params).then(res => res) };
//成交明细

export const transactionDetails = params => { return axios.get(`${base}/revisedTradePool/transactionDetails`, { params: params }).then(res => res) };

export const listEntrust = params => { return axios.get(`${base}/revisedTradePool/listEntrust`, { params: params }).then(res => res) };

//充币提币
// 获取所有币种
export const listVirtualWallet = params => { return axios.post(`${base}/coinTrade/listVirtualWallet`, params).then(res => res) };
//充币/提币
export const getUserVirtualWalletInfo = params => { return axios.post(`${base}/coinTrade/getUserVirtualWalletInfo`, params).then(res => res) };
//充币提币记录
export const getUserRechargeList = params => { return axios.post(`${base}/coinTrade/getUserCoinTradeList`, params).then(res => res) };
//发起提币
export const askForWithdraw = params => { return axios.post(`${base}/coinTrade/askForWithdraw`, params).then(res => res) };
//提币订单详情
export const showDetail = params => { return axios.post(`${base}/coinTrade/showDetail`, params).then(res => res) };
//新增提币地址
export const insertWithdrawAddress = params => { return axios.post(`${base}/withdraw/insertWithdrawAddress`, params).then(res => res) };
//地址列表
export const listWithdrawAddress = params => { return axios.post(`${base}/withdraw/listWithdrawAddress`, params).then(res => res) };
//删除提币地址
export const deleteWithdrawAddress = params => { return axios.post(`${base}/withdraw/deleteWithdrawAddress`, params).then(res => res) };

// 资产
// 资产账户
export const userVirtualWallet = params => { return axios.get(`${base}/app/userVirtualWallet/userVirtualWallet`, { params: params }).then(res => res) };

// 财务记录
export const financialRecord = params => { return axios.get(`${base}/app/userVirtualWallet/financialRecord`, { params: params }).then(res => res) };
// 币种列表

export const virtualWalletList = params => { return axios.get(`${base}/virtualWallet/list`, { params: params }).then(res => res) };
// 资产换算汇率

// 消息
// 公告部分
export const regularAnnouncement = params => { return axios.get(`${base}/message/regularAnnouncement`, { params: params }).then(res => res) };

//帮助中心
// 帮助头部列表

export const getAllHelpCat = params => { return axios.post(`${base}/helpContent/getAllHelpCat`, params).then(res => res) };
// 帮助中间详细列表
export const getCatAndContentList = params => { return axios.post(`${base}/helpContent/getCatAndContentList`, params).then(res => res) };
// 帮助的详情

export const getContentById = params => { return axios.post(`${base}/helpContent/getContentById`, params).then(res => res) };
export const searchHelpContent = params => { return axios.post(`${base}/helpContent/searchHelpContent`, params).then(res => res) };



//daxin
//申购列表
export const makeNewSettingList = params => { return axios.get(`${base}/makeNewSetting/makeNewSettingList`, { params: params }).then(res => res) };
//代币分配比例
export const tokenTypeList = params => { return axios.get(`${base}/makeNewSetting/tokenTypeList`, { params: params }).then(res => res) };
//申购活动详情
export const makeNewSettingDetails = params => { return axios.get(`${base}/makeNewSetting/makeNewSettingDetails`, { params: params }).then(res => res) };
//申购详情
export const userMakeNewSettingRecord = params => { return axios.get(`${base}/userMakeNewSettingRecord/detail`, { params: params }).then(res => res) };
//申购
export const userBuy = params => { return axios.post(`${base}/userMakeNewSettingRecord/userBuy`, params).then(res => res) };
//验证交易密码
export const checkTradePassword = params => { return axios.post(`${base}/user/checkTradePassword`, params).then(res => res) };
//验证校验手机号码
export const checkPhoneCode = params => { return axios.post(`${base}/user/checkPhoneCode`, params).then(res => res) };
//申购订单
export const orderTotal = params => { return axios.get(`${base}/userMakeNewSettingRecord/orderTotal`, { params: params }).then(res => res) };
//中签订单
export const signOrderTotal = params => { return axios.get(`${base}/userMakeNewSettingRecord/signOrderTotal`, { params: params }).then(res => res) };
//中签公示
export const Publicity = params => { return axios.get(`${base}/userPurchaseNumber/Publicity`, { params: params }).then(res => res) };
//中签号码
export const signNumber = params => { return axios.get(`${base}/userPurchaseNumber/signNumber`, { params: params }).then(res => res) };

// 获取币对k线 
export const getKlineDataByIntervalTimeForHttp = params => { return axios.get(`${que81}/getKlineDataByIntervalTimeForHttp`, { params: params }).then(res => res) };

//中签弹窗
export const signNumberPopUp = params => { return axios.get(`${base}/userPurchaseNumber/signNumberPopUp`, { params: params }).then(res => res) };
//弹窗状态
export const popUpType = params => { return axios.post(`${base}/userPurchaseNumber/popUpType`, params).then(res => res) };


// 合约币对
export const getAllAgreement = params => { return axios.post(`${base}/agreementEntrust/getAllAgreement`, params).then(res => res) };
//合约委托列表
export const agreementlistEntrust = params => { return axios.post(`${base}/agreementEntrust/listEntrust`, params).then(res => res) };
//是否设置交易密码
export const checkTradeWord = params => { return axios.post(`${base}/user/checkTradeWord`, params).then(res => res) };
//确认已付款
export const confirmPay = `${base}/payment/confirm`;

export const toPaymentCenter = `http://103.214.146.88:8091/payment/center`;
//模拟订单
export const paySign = params => { return axios.post(`${base}/otcTrade/sign4order`, params).then(res => res); };
// 付款

export const payment = params => { return axios.post(`${base}/userMakeNewSettingRecord/payment`, params).then(res => res); };

// 语言
export const language = params => { return axios.get(`${base}/user/language`, { params: params }).then(res => res) };

// 通道3
export const roadThree = params => { return axios.post(`${base}/otcTrade/c/sign4order`, params).then(res => res); };
//通道2
export const roadTwo = params => { return axios.post(`${base}/otcTrade/b/sign4order`, params).then(res => res); };
//出金
export const outSale = params => { return axios.post(`${base}/otcSale/a/sale`, params).then(res => res); };
//查看银行卡信息
export const viewBanks = params => { return axios.get(`${base}/userBank/viewBank`, { params: params }).then(res => res) };
//添加卡号
export const addBanks = params => { return axios.post(`${base}/userBank/addBank`, params).then(res => res); };


//otc出金
export const otcSaleList = params => { return axios.post(`${base}/otcSale/a/list`, params).then(res => res); };

//汇率
export const getRatio = params => { return axios.post(`${base}/otcSale/a/getRatio`, params).then(res => res); };


// -----------------------------------------------------
export const getExchangeRateByCoinName =
    params => { return axios.get(`${ques81}/quotesExchangeRate/getExchangeRateByCoinName`, { params: params }).then(res => res) };

//查看所有行情 币对
export const get24hrDataForAll =
    params => { return axios.get(`${ques81}/quotations/get24hrDataForAll`, { params: params }).then(res => res) };
//盘口和深度图
export const getBuySellData =
    params => { return axios.get(`${ques81}/quotations/getBuySellData`, { params: params }).then(res => res) };
//币对
export const get24hrDataByTwoCoinName =
    params => { return axios.get(`${ques81}/quotations/get24hrDataByTwoCoinName`, { params: params }).then(res => res) };
// 合约币对
export const get24hrDataForAgreement =
    params => { return axios.get(`${ques81}/quotations/get24hrDataForAgreement`, { params: params }).then(res => res) };
